#ifndef GRAPH_DB_SERVICE_H
#define GRAPH_DB_SERVICE_H
#include <grpcpp/grpcpp.h>
#include "../../generated/crud_service.grpc.pb.h"


using grpc::ServerContext;
using grpc::Status;
using namespace graph;

class DbCRUDService final : public CRUDService::Service{
    // --- CRUD 操作接口 (供 heartwall 后端同步数据) ---

    // --- 创建 (Create) ---
    Status CreateUser(ServerContext* context, 
                     const CreateUserRequest* request, 
                     CreateUserResponse* response) override;

    Status CreateList(ServerContext* context, 
                     const CreateListRequest* request, 
                     CreateListResponse* response) override;

    Status CreateTodo(ServerContext* context, 
                     const CreateTodoRequest* request, 
                     CreateTodoResponse* response) override;

    Status CreateComment(ServerContext* context, 
                        const CreateCommentRequest* request, 
                        CreateCommentResponse* response) override;

    Status CreateEntity(ServerContext* context, 
                       const CreateEntityRequest* request, 
                       CreateEntityResponse* response) override;

    Status CreateTimeSlot(ServerContext* context, 
                         const CreateTimeSlotRequest* request, 
                         CreateTimeSlotResponse* response) override;

    Status CreateTrendScore(ServerContext* context, 
                           const CreateTrendScoreRequest* request, 
                           CreateTrendScoreResponse* response) override;

    // --- 更新 (Update) ---
    Status UpdateUser(ServerContext* context, 
                     const UpdateUserRequest* request, 
                     UpdateUserResponse* response) override;

    Status UpdateList(ServerContext* context, 
                     const UpdateListRequest* request, 
                     UpdateListResponse* response) override;

    Status UpdateTodo(ServerContext* context, 
                     const UpdateTodoRequest* request, 
                     UpdateTodoResponse* response) override;

    Status UpdateComment(ServerContext* context, 
                        const UpdateCommentRequest* request, 
                        UpdateCommentResponse* response) override;

    Status UpdateEntity(ServerContext* context, 
                       const UpdateEntityRequest* request, 
                       UpdateEntityResponse* response) override;

    // --- 删除 (Delete) ---
    Status DeleteUser(ServerContext* context, 
                     const DeleteUserRequest* request, 
                     DeleteUserResponse* response) override;

    Status DeleteList(ServerContext* context, 
                     const DeleteListRequest* request, 
                     DeleteListResponse* response) override;

    Status DeleteTodo(ServerContext* context, 
                     const DeleteTodoRequest* request, 
                     DeleteTodoResponse* response) override;

    Status DeleteComment(ServerContext* context, 
                        const DeleteCommentRequest* request, 
                        DeleteCommentResponse* response) override;

    Status DeleteEntity(ServerContext* context, 
                       const DeleteEntityRequest* request, 
                       DeleteEntityResponse* response) override;

    // --- 读取 (Read) - 单个查询 ---
    Status GetUser(ServerContext* context, 
                  const GetUserRequest* request, 
                  GetUserResponse* response) override;

    Status GetList(ServerContext* context, 
                  const GetListRequest* request, 
                  GetListResponse* response) override;

    Status GetTodo(ServerContext* context, 
                  const GetTodoRequest* request, 
                  GetTodoResponse* response) override;

    Status GetComment(ServerContext* context, 
                     const GetCommentRequest* request, 
                     GetCommentResponse* response) override;

    Status GetEntity(ServerContext* context, 
                    const GetEntityRequest* request, 
                    GetEntityResponse* response) override; 
};
#endif